<table class='list_job' style="width: 100%;">
	<tbody>
		<tr>
			<th class='list_employer' colspan='4' style='text-align: center; width: 100%'> Danh sách doanh nghiệp</th>
		</tr>
		<tr>
			<td class="stt">STT</td>
			<td>Email đăng nhập</td>
			<td style="width: 10%; padding: 3px; text-align: center;">Trạng thái</td>
			<td style="width: 15%; text-align: center;">Tuỳ chọn</td>
		</tr>
		<?php
			if(isset($user) && count($user)){
				$i = 1;
				foreach ($user as $key => $val) {
					if($val['level'] == 1){
						echo "<tr>";
							echo "<td class='stt'>".$i."</td>";
							echo "<td><a href='".base_url()."admin/user/employer_detail/".$val['id_dn']."'>".$val['email_dn']."</a></td>";
							if($val['active'] == 0){
								echo "<td style='text-align:center;'><a href='".base_url()."admin/user/active/".$val['id_dn']."' title='Kích hoạt tài khoản'><img src='".base_url()."public/img/cross.png'></a></td>";
							}else if($val['active'] == 1){
								echo "<td style='text-align:center;'><a href='".base_url()."admin/user/deactive/".$val['id_dn']."' title='Bỏ kích hoạt tài khoản'><img src='".base_url()."public/img/tick.png'></a></td>";
							}
							echo "<td style='text-align:center;'><a href='#' onclick='delete_user(".$val['id_dn'].")' title='Xoá tài khoản này'><img src='".base_url()."public/img/delete.png'></a></td>";
						echo "</tr>";
						$i++;
					}
				}
			}
		?>
		<tr>
			<th class='list_student' colspan='4' style='text-align: center; width: 100%'> Danh sách sinh viên</th>
		</tr>
		<tr>
			<td class="stt">STT</td>
			<td>Email đăng nhập</td>
			<td style="width: 10%; padding: 3px; text-align: center;">Trạng thái</td>
			<td style="width: 15%; text-align: center;">Tuỳ chọn</td>
		</tr>
		<?php
			if(isset($user) && count($user)){
				$i = 1;
				foreach ($user as $key => $val) {
					if($val['level'] == 2){
						echo "<tr>";
							echo "<td class='stt'>".$i."</td>";
							echo "<td><a href='".base_url()."admin/user/student_detail/".$val['id_dn']."'>".$val['email_dn']."</a></td>";
							if($val['active'] == 0){
								echo "<td style='text-align:center;'><a href='".base_url()."admin/user/active/".$val['id_dn']."' title='Kích hoạt tài khoản'><img src='".base_url()."public/img/cross.png'></a></td>";
							}else if($val['active'] == 1){
								echo "<td style='text-align:center;'><a href='".base_url()."admin/user/deactive/".$val['id_dn']."' title='Bỏ kích hoạt tài khoản'><img src='".base_url()."public/img/tick.png'></a></td>";
							}
							echo "<td style='text-align:center;'><a href='#' onclick='delete_user(".$val['id_dn'].")' title='Xoá tài khoản này'><img src='".base_url()."public/img/delete.png'></a></td>";
						echo "</tr>";
						$i++;
					}
				}
			}
		?>
	</tbody>
</table>

<script type="text/javascript">
	function delete_user(id) {
		if(confirm("Are you sure?") == true){
			window.location.href = "<?php echo base_url() ?>admin/user/delete/"+id;
		}
	}
</script>
